import request from '@/utils/request';
import { praseStrEmpty } from '@/utils/tencreat';

// 查询店铺列表
export function listStore(query) {
	return request({
		url: '/mall/store/list',
		method: 'post',
		data: query,
	});
}

// 查询所有用户
export function getUserList() {
	return request({
		url: '/mall/user/userlist',
		method: 'get',
	});
}
// 查询用户详细
export function getStore(id) {
	return request({
		url: '/mall/store/getInfo',
		method: 'post',
		data: { id: id },
	});
}

// 新增用户
export function addStore(data) {
	return request({
		url: '/mall/store/add',
		method: 'post',
		data: data,
	});
}

// 查询用户详细
export function getStoreUser(userId) {
	return request({
		url: '/mall/store/' + praseStrEmpty(userId),
		method: 'get',
	});
}

// 查询顶层地址
export function getArea() {
	return request({
		url: '/api/account/open/province',
		method: 'post',
	});
}

// 查询地区地址
export function getCity(data) {
	return request({
		url: '/api/account/open/city_county',
		method: 'post',
		data: data,
	});
}

// 查询市区地址
export function municipalAddress(data) {
	return request({
		url: '/api/account/open/city_county',
		method: 'post',
		data: data,
	});
}

// 编辑用户
export function updateStore(data) {
	return request({
		url: '/mall/store/edit',
		method: 'post',
		data: data,
	});
}

// 删除用户
export function delStore(id) {
	return request({
		url: '/mall/store/remove',
		method: 'post',
		data: { id: id },
	});
}

// 重置密码
export function forgetPassword(data) {
	return request({
		url: '/mall/store/forget_password',
		method: 'post',
		data: data,
	});
}

// 导出用户
export function exportStore(data) {
	return request({
		url: '/mall/store/export',
		method: 'post',
		data: data,
	});
}

export function newListStore(data) {
	return request({
		url: '/mall/store/new_store',
		method: 'post',
		data: data,
	});
}
export function getStoreInfo(data) {
	return request({
		url: '/mall/store/getInfo',
		method: 'post',
		data: data,
	});
}

export function getGrouplist(data) {
	return request({
		url: '/mall/store/grouplist',
		method: 'post',
		data: data,
	});
}

export function getGroupDownlist(data) {
	return request({
		url: '/mall/supplier/groupdownlist',
		method: 'post',
		data: data,
	});
}
export function auditStore(data) {
	return request({
		url: '/mall/store/audit',
		method: 'post',
		data: data,
	});
}
export function getFinanceList(data) {
	return request({
		url: '/system/finance/list',
		method: 'post',
		data: data,
	});
}
export function getFinanceEarnings(params) {
	return request({
		url: '/system/finance/earnings',
		method: 'get',
		params,
	});
}

export function exportFinanceList(data) {
	return request({
		url: '/system/finance/export',
		method: 'post',
		data: data,
	});
}
export function exportFinanceList2(data) {
	return request({
		url: '/system/finance/goodsPaymentExport',
		method: 'post',
		data: data,
	});
}
export function getFinanceStatistical(data) {
	return request({
		url: '/system/finance/getFinanceStatistical',
		method: 'post',
		data: data,
	});
}
export function getGoodsPayment(data) {
	return request({
		url: '/system/finance/goodsPayment',
		method: 'post',
		data: data,
	});
}
export function getOrderInfo(data) {
	return request({
		url: '/system/finance/getOrderInfo',
		method: 'post',
		data: data,
	});
}

export function getFinanceInfo(data) {
	return request({
		url: '/system/finance/getSupplierInfo',
		method: 'post',
		data: data,
	});
}

export function queryStoreStatics() {
	return request({
		url: '/mall/store/mallStoreStatics',
		method: 'get',
	});
}
